<div class="bjui-pageContent">
    <div style="text-align : center">
        <div class="row-input" id="begin">开始</div>
        <br/>
        <div class="row-input" id="0" style="cursor:pointer" title="点击添加步骤" onclick="addFlowConfigProcess(this)">&#8595;</div>
        <br/>
        <div class="row-input" id="0">结束</div>
    </div>
</div>
<script>
    (function () {

        var flow_config_list_str = '{{$flow_config_list}}';
        var flow_config_list = JSON.parse(flow_config_list_str.replace(/\&quot;/g,'"'));
        var oBegin = $.CurrentNavtab.find("#begin");

        for (var i=0, k=0; i< flow_config_list.length;i++) {
            if (i == 0) {
                for(var j=0; j<flow_config_list.length;j++) {
                    if (flow_config_list[j].pid==0) {
                        oBegin.after('<br/><div style="cursor:pointer" title="点击添加步骤" class="row-input" id="'+ flow_config_list[j].id +'" onclick="addFlowConfigProcess(this)">&#8595;</div><br/><div style="cursor:pointer;width:auto; display:inline-block !important;" title="点击编辑步骤" id="'+ flow_config_list[j].id +'"  onclick="editFlowConfigProcess(this)">'+flow_config_list[j].description+'<div>');
                        k=flow_config_list[j].id;
                    }
                }
            } else {
                for(var j=0; j<flow_config_list.length;j++) {
                    if (flow_config_list[j].pid==k) {
                        oBegin.after('<br/><div style="cursor:pointer" title="点击添加步骤" class="row-input" id="'+ flow_config_list[j].id +'" onclick="addFlowConfigProcess(this)">&#8595;</div><br/><div style="cursor:pointer;width:auto; display:inline-block !important;" title="点击编辑步骤" id="'+ flow_config_list[j].id +'"  onclick="editFlowConfigProcess(this)">'+flow_config_list[j].description+'<div>');
                        k=flow_config_list[j].id;
                    }
                }
            }
        }
    })();
    function addFlowConfigProcess(flow)
    {
        BJUI.dialog({
            id:'add-flow-config',
            url:'/admin/administration/workflow/flow-config-process-add',
            title:'添加流程',
            mask:true,
            data:{id:flow.id, oa_flow_config_id: {{$flow_config_id}} },
            width: 400,
            height: 500
        })
    }
    function editFlowConfigProcess(flow)
    {
        BJUI.dialog({
            id:'edit-flow-config',
            url:'/admin/administration/workflow/flow-config-process-edit',
            title:'编辑流程',
            mask:true,
            data:{id:flow.id},
            width: 400,
            height: 500
        })
    }
</script>